import { Methods } from "./router";
import { Rendering as Index } from "./src/index";
import { Rendering as Topic } from "./src/topic";
import { Rendering as Find } from "./src/find";
import { Rendering as Information } from "./src/information";
import { Rendering as Essay } from "./src/essay";
import { Component } from './src/component';

//单击导航栏
let nav = document.querySelectorAll(".head-nav a"),
    selectNav = nav[0];

nav.forEach((value,index,array)=>{
    value.onclick = ()=>{
        if(selectNav){
            selectNav.style.background = "#0661bd";
        }
        value.style.background = "#061dbd";
        selectNav = value;
    }
});
//单击导航栏end

let data = [{title:"测试1",author:"xwj",content:"主要内容" +
"主要内容主要内容主要内容主要内容主要内容主要内容主要内容" +
"主要内容主要内容主要内容主要内容主要内容主要内容主要内容主要内容" +
"主要内容主要内容主要内容主要内容主要内容主要内容主要内容" +
"主要内容主要内容主要内容主要内容主要内容主要内容主要内容主要内容主要内容主要内容主要内容" +
"主要内容主要内容主要内容主要" +
"",image:"./image/icon.jpg",comment:[{content:"12",author:"xwj",date:"2017",reply:"test"}]},
    {title:"测试2",author:"xwj",content:"199919991999199919991999" +
    "19991999199919991999" +
    "199919991999199919991999" +
    "199919991999199919991999" +
    "199919991999199919991999" +
    "199919991999199919991999" +
    "199919991999199919991999" +
    "199919991999199919991999",image:"",comment:[
        {content:"12",author:"xwj",date:"2017",reply:"test"},
        {content:"12",author:"xwj",date:"2017",reply:""}
        ]}];

let methods = new Methods();
methods.map("/index",function () {methods.asyncFun(Index)},Component.contentMenu,data);
methods.map("/topic",function () {methods.asyncFun(Topic)},"","");
methods.map("/find",function () {methods.asyncFun(Find)},"","");
methods.map("/information",function () {methods.asyncFun(Information)},"","");
methods.map("/essay",function () {methods.asyncFun(Essay)},"","");
methods.init();